package com.zulin.quartz;

import org.quartz.Job;
import org.quartz.JobDataMap;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.quartz.JobKey;

import com.zulin.mail.Mail;

public class Jobs implements Job {
	
	
	
	private static final String smtp = "smtp.163.com";
	private static final String from = "15989774866@163.com";
	private static final String to = "335882264@qq.com";
	private static final String username = "15989774866@163.com";
	private static final String password = "lin123";
	
	

	public void execute(JobExecutionContext context) throws JobExecutionException {
		
		JobKey key = context.getJobDetail().getKey();
	    JobDataMap dataMap = context.getJobDetail().getJobDataMap();
	    String jobSays = dataMap.getString("jobSays");
	    String title = dataMap.getString("title");
	    String content = dataMap.getString("content");

	    System.err.println("Instance " + key + " of DumbJob says: " + jobSays );
	    System.err.println("title"+title);
	    System.err.println(content);
	    Mail.send(smtp, from, to, title, content, username, password);
		
	}
	
	
	
}
